# $Id: $

package Zuz::Utils;
use strict;
use warnings;

use base qw (Exporter);

our @EXPORT_OK = qw(
	get_user_type
	is_module_name_valid
);


sub get_user_type {
	my $self = shift;
	
	return 'unknown' if not $self->{'session'};
	return $self->{'session'}->user_id->user_type;
}


sub is_module_name_valid {
	my $module = shift;

	return if !$module;
	return if $module !~ /^[\w:]{1,60}$/g;

	$module =~ s/::/\\/g;

	if ( -e "$ENV{'ZUZ'}\\lib\\$module.pm" ) {
		return 1;
	}
	else {
		return 0;
	}
}


1;